﻿@model RBS.Core.Model.D_Order
@{
    ViewBag.Title = "电话预定添加";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="~/Scripts/datepicker/skin/WdatePicker.css" rel="stylesheet" />
<script src="~/Scripts/datepicker/lang/zh-cn.js"></script>
<script src="~/Scripts/datepicker/WdatePicker.js"></script>
 @{
    @Html.Partial("_Location");
}
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.H_Id) 
    @Html.HiddenFor(model => model.Id)  
 
    <div class="content-tab-wrap">
        <div id="floatHead" class="content-tab">
            <div class="content-tab-ul-wrap">
                <ul>
                    <li><a href="javascript:;" onclick="tabs(this);" class="selected">电话预定添加</a></li> 
                </ul>
            </div>
        </div>
    </div> 
            <div class="tab-content destineorder">
                <dl>
                    <dt><b>*</b>预订吃饭日期</dt>
                    <dd>
                        @Html.TextBoxFor(model => model.OrderTime, null, new { @class = "input normal", onfocus = "WdatePicker({doubleCalendar:true,dateFmt:'yyyy年MM月dd日 HH时mm分',minDate:'%y-%M-{%d}',onpicked:pickedFunc})", @readonly = "readonly" }) 
                    </dd>
                </dl>
                <dl>
                    <dt><b>*</b>就餐人数</dt>
                    <dd>
                        @Html.TextBoxFor(model => model.DineNum, null, new { @class = "input small", datatype = "n", value = "" })
                        <span class="Validform_checktip">*就餐人数</span>
                    </dd>
                </dl>
                <dl>
                    <dt><b>*</b>座位</dt>
                    <dd  >
                        <div id="seatUl" class="rule-multi-radio" >  
                         </div>    
                    </dd>
                </dl> 
                <dl>
                    <dt><b>*</b>联系人</dt>
                    <dd>

                        @Html.TextBoxFor(model => model.ContactUser, null, new { @class = "input normal w100" })
                        <span class="Validform_checktip">*联系人</span> 
                    </dd>
                </dl>
                <dl>
                    <dt><b>*</b>用户手机</dt>
                    <dd> 
                        @Html.TextBoxFor(model => model.ContactMobile, null, new { @class = "input normal w100" })
                        <span class="Validform_checktip">*用户手机</span>

                    </dd>
                </dl>
                <dl>
                    <dt>订单备注</dt>
                    <dd> 
                        @Html.TextBoxFor(model => model.OrderRemark, null, new { @class = "input normal" })
                        <span class="Validform_checktip">*订单备注</span> 
                    </dd>
                </dl>
               
            </div>
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-list">
             @Html.Hidden("SetOrder")
            <input type="submit" value="提交保存" class="btn" />
            <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />

        </div>
        <div class="clear"></div>
    </div>
    <script>
        $(function () {
            
        });

        function pickedFunc() {
           /* $dp.$('d523_y').value=$dp.cal.getP('y');
            $dp.$('d523_M').value=$dp.cal.getP('M');
            $dp.$('d523_d').value=$dp.cal.getP('d');
            $dp.$('d523_HH').value=$dp.cal.getP('H');
            $dp.$('d523_mm').value=$dp.cal.getP('m');
            $dp.$('d523_ss').value=$dp.cal.getP('s');*/ 
            selectTable();
        }
     
        function selectTable() {   
            var OrderTime = $("#OrderTime").val(); 
            $.get("@Url.Action("GetSeatStatus")?time=" + OrderTime, function (result) { 
                if (result.IsSuccess) {
                    $("#seatUl").empty(); 
                    $.each(result.Data, function (index, row) {  
                        var template = $('#SeatTemplate').html(); //获取模版的html 
                        var bookData = Mustache.render(template, row);//把每行的数据填充到模版得到html内容
                        $("#seatUl").append(bookData);
                        $("#seatUl").ruleMultiRadio();
                    });
                } 
            });
          
        } 
        $.extend($.Datatype, {
            "seat": function (gets, obj, curform, regxp) {
                var need = 1,
                    numselected = curform.find("input[name='" + obj.attr("name") + "']:checked").length;
                return numselected >= need ? true : false;
            }
        });
         
    </script> 
    <script type="text/template" id="SeatTemplate"> 
                <label for="seat">{{Name}}({{Numbers}}人)  </label>
                <input type="radio" id="seat" name="seat" value="{{Id}}|{{Category}}" /> 
    </script> 
        
}